package net;

import java.io.IOException;
import java.net.*;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;

public class UDPSendTest1 {
    public static void main(String[] args) throws IOException {
        DatagramSocket datagramSocket = new DatagramSocket();
        List<String> list = new ArrayList<>();
        list.add("YUYUDEQIU");
        list.add("CCC");
        list.add("QQQQQ");
        list.add("NIUZIGE");

        for (String s : list) {
            byte[] bytes = s.getBytes(StandardCharsets.UTF_8);
            DatagramPacket datagramPacket = new DatagramPacket(bytes, bytes.length, InetAddress.getByName("127.0.0.1"), 9999);
            datagramSocket.send(datagramPacket);
        }

    }
}
